﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            // axCarousel2.i
            axCarousel1.Focus();
            axCarousel1.SetBackgroundColor(Color2Uint32(Color.Aqua));
        }

        private void button1_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.Filter = "All Files (*.*)|*.*|PhotoShop (*.psd)|*.psd|JPEG 2000 (*.j2k)|*.j2k;*.j2c|JPEG (*.jpg)|*.jpg|PCX (*.pcx)|*.pcx|WMF (*.wmf)|*.wmf|Wireless Bitmap (*.wbmp)|*.wbmp|Bitmap (*.bmp)|*.bmp|TIF (*.tif)|*.tif|TGA (*.tga)|*.tga|Gif (*.gif)|*.gif |PGX (*.pgx)|*.pgx|RAS (*.ras)|*.ras|PNM (*.pnm)|*.pnm|PNG (*.png)|*.png|Icon (*.ico)|*.ico";
                if (ofd.ShowDialog(this) == DialogResult.OK)
                {
                    this.axCarousel15.AddThumbnail(ofd.FileName);
                    this.axCarousel15.Focus();

                }
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.axCarousel15.DeleteAllThumbnail();
            this.axCarousel15.Focus();
        }

        private void button2_Click(object sender, EventArgs e)
        {

            using (ColorDialog cd = new ColorDialog())
            {
                if (cd.ShowDialog(this) == DialogResult.OK)
                {
                    this.axCarousel15.SetBackgroundColor(Color2Uint32(cd.Color));
                    this.axCarousel15.Focus();
                   
                }
            }
        }

        public uint Color2Uint32(Color clr)
        {

            int t;
            byte[] a;

            t = ColorTranslator.ToOle(clr);

            a = BitConverter.GetBytes(t);

            return BitConverter.ToUInt32(a, 0);

        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.axCarousel15.ResizeControl(Convert.ToInt16(textBox1.Text), Convert.ToInt16(textBox2.Text));
            this.axCarousel15.Focus();
        }

        private void axCarousel1_ThumbnailClick(object sender, AxCAROUSELLib._DCarouselEvents_ThumbnailClickEvent e)
        {
            string strFile = axCarousel15.GetThumbnailFileName(e.iThumbnailIndex);
            if (strFile.Length != 0)
                MessageBox.Show("you clicked " + strFile);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetThumbnailSize(1);
            this.axCarousel15.Focus();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetThumbnailSize(2);
            this.axCarousel15.Focus();
     

        }

        private void button7_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetThumbnailSize(3);
            this.axCarousel15.Focus();
     
        }

        private void button8_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetThumbnailSize(4);
            this.axCarousel15.Focus();
     
        }

        private void button9_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetThumbnailSize(5);
            this.axCarousel15.Focus();
     
        }

        private void button10_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetThumbnailSize(6);
            this.axCarousel15.Focus();
     
        }

        private void button11_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetThumbnailSize(7);
            this.axCarousel15.Focus();
     
        }

        private void button12_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetThumbnailSize(8);
            this.axCarousel15.Focus();
     
        }

        private void button13_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetThumbnailSize(9);
            this.axCarousel15.Focus();
     
        }

        private void button14_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetTopDownDir(1);
            this.axCarousel15.Focus();
     
        }

        private void button15_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetTopDownDir(-1);
            this.axCarousel15.Focus();
        }

        private void chkkeyboard_CheckedChanged(object sender, EventArgs e)
        {
            if (chkkeyboard.Checked)
                this.axCarousel15.UseMouseControl=false;
            else
                this.axCarousel15.UseMouseControl=true;

            this.axCarousel15.Focus();
         
        }

        private void button16_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetLeftRightDir(-1);
            this.axCarousel15.Focus();
        }

        private void button18_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetLeftRightDir(-0.5);
            this.axCarousel15.Focus();
        }

        private void button19_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetLeftRightDir(-0.2);
            this.axCarousel15.Focus();

        }

        private void button17_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetLeftRightDir(1);
            this.axCarousel15.Focus();
        }

        private void button20_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetLeftRightDir(0.5);
            this.axCarousel15.Focus();
        }

        private void button21_Click(object sender, EventArgs e)
        {
            this.axCarousel15.SetLeftRightDir(0.2);
            this.axCarousel15.Focus();
        }
        
        private void Form1_Load(object sender, EventArgs e)
        {

        }

    }
}
